from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
from crmeb_project.testcases.crmeb_test import TestCaseCrmeb as TC
import allure
@allure.feature("测试用户分组")
class TestUserGroup(HttpRunner):
    config = Config("crmeb测试用例").verify(False).variables(**{"user": "admin", "pwd": "920509"}).base_url(
        "${get_url()}")
    teststeps= [
        Step(  # Step表示这是一条接口用例
            RunTestCase("登录用例解耦").call(TC).export("token","icon") # call：调用解耦的测试用例类，
            # export：用例reponse提出来的内容，需要写在这里面

        ),
        Step(
            RunRequest("新增用户分组").
                post("/adminapi/user/user_group/save.html").
                with_headers(**{'Authori-zation': 'Bearer $token'}).
                with_json({"group_name":"关博文10" + "${uuid_name()}"}). #引用debugtalk.py函数，不需要导入文件，直接引用
                validate().
                assert_equal("body.msg","提交成功！").
                assert_equal("status_code",200)

        ),]
